import request from '@/router/axios';

import {getSwAuConductorHierarchyAmountDifferenceList} from "../../shouPiaoYuanCJCY";
import {fenExYuangettoFixed,fenExYuangettoFixed3} from "../../../../commonCheck";

export async function getDXCSwAuConductorHierarchyAmountDifferenceList(query){
  return await getSwAuConductorHierarchyAmountDifferenceList(query);
}

export  function getMondifyData1(row) {
  let res=[];
  let one={};
  let two={};
  let three={};
  if(row.comparativeType==1){ //SC与LC
    one.type="SC";
    two.type="LC";
  }else if(row.comparativeType==2){
    one.type="LC";
    two.type="ACC";
  }

  one.sellAmount=fenExYuangettoFixed(row,'sellAmount');
  one.investAmount=fenExYuangettoFixed(row,'investAmount');
  one.faretkAmount=fenExYuangettoFixed(row,'faretkAmount');
  one.sum=fenExYuangettoFixed3(Number(one.sellAmount) + Number(one.investAmount) + Number(one.faretkAmount));

  two.sellAmount=fenExYuangettoFixed(row,'comparativeSelltkAmount');
  two.investAmount=fenExYuangettoFixed(row,'comparativeInvestAmount');
  two.faretkAmount=fenExYuangettoFixed(row,'comparativeFaretkAmount');
  two.sum=fenExYuangettoFixed3(Number(two.sellAmount) + Number(two.investAmount) + Number(two.faretkAmount));

  three.type="差异";
  three.sellAmount=fenExYuangettoFixed3(Number(one.sellAmount)-Number(two.sellAmount));
  three.investAmount=fenExYuangettoFixed3(Number(one.investAmount)-Number(two.investAmount));
  three.faretkAmount=fenExYuangettoFixed3(Number(one.faretkAmount)-Number(two.faretkAmount));
  three.sum=fenExYuangettoFixed3(Number(one.sum)-Number(two.sum));

  res.push(one);
  res.push(two);
  res.push(three);
 return res;
}
export const cols1= {
  emptyBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  border: true,
  index: false,
  menu:false,
  refreshBtn:false,
  columnBtn:false,
  indexLabel: '序号',
  page: false,
  align: 'center',
  menuWidth: 150,
  menuAlign: 'center',
  selection: false,
  reserveSelection: false,
  column: [{
    label: '系统层级',
    prop: "type",
  },
    {
      label: '售票金额',
      prop: "sellAmount",
    },
    {
      label: '充值金额',
      prop: "investAmount",
    },
    {
      label: '补票金额',
      prop: "faretkAmount",
    },
    {
      label: '合计',
      prop: "sum",
    }]
};


export  function getMondifyData2(row) {
  let res=[];
  let one={};
  let two={};
  let three={};
  if(row.comparativeType==1){ //SC与LC
    one.type="SC";
    two.type="LC";
  }else if(row.comparativeType==2){
    one.type="LC";
    two.type="ACC";
  }
  //-----------------------------
  one.sellAmount=fenExYuangettoFixed(row,'sellAmount');
  one.replySellAmount=fenExYuangettoFixed(row,'replySellAmount');
  one.replySellAmountCY=fenExYuangettoFixed3(one.sellAmount-one.replySellAmount);//差异

  one.investAmount=fenExYuangettoFixed(row,'investAmount');
  one.replyInvestAmount=fenExYuangettoFixed(row,'replyInvestAmount');
  one.replyInvestAmountCY=fenExYuangettoFixed3(one.investAmount-one.replyInvestAmount);//差异

  one.faretkAmount=fenExYuangettoFixed(row,'faretkAmount');
  one.replyFaretkAmount=fenExYuangettoFixed(row,'replyFaretkAmount');
  one.replyFaretkAmountCY=fenExYuangettoFixed3(one.faretkAmount-one.replyFaretkAmount);//差异
  one.sum=fenExYuangettoFixed3(Number(one.replySellAmount)+Number(one.replyInvestAmount)+Number(one.replyFaretkAmount));
//-----------------------------------

  two.sellAmount=fenExYuangettoFixed(row,'comparativeSelltkAmount');
  two.replySellAmount=fenExYuangettoFixed(row,'replySellAmount');
  two.replySellAmountCY=fenExYuangettoFixed3(two.replySellAmount-two.replySellAmount);//差异

  two.investAmount=fenExYuangettoFixed(row,'comparativeInvestAmount');
  two.replyInvestAmount=fenExYuangettoFixed(row,'replyInvestAmount');
  two.replyInvestAmountCY=fenExYuangettoFixed3(two.investAmount-two.replyInvestAmount);//差异

  two.faretkAmount=fenExYuangettoFixed(row,'comparativeFaretkAmount');
  two.replyFaretkAmount=fenExYuangettoFixed(row,'replyFaretkAmount');
  two.replyFaretkAmountCY=fenExYuangettoFixed3(two.faretkAmount-two.replyFaretkAmount);//差异
  two.sum=fenExYuangettoFixed3(Number(two.replySellAmount)+Number(two.replyInvestAmount)+Number(two.replyFaretkAmount));

  three.type="差异";
  three.sellAmount=fenExYuangettoFixed3(Number(one.sellAmount)-Number(two.sellAmount));
  three.replySellAmount=fenExYuangettoFixed3(Number(one.replySellAmount)-Number(two.replySellAmount));
  three.replySellAmountCY='';//差异

  three.investAmount=fenExYuangettoFixed3(Number(one.investAmount)-Number(two.investAmount));
  three.replyInvestAmount=fenExYuangettoFixed3(Number(one.replyInvestAmount)-Number(two.replyInvestAmount));
  three.replyInvestAmountCY='';//差异

  three.faretkAmount=fenExYuangettoFixed3(Number(one.faretkAmount)-Number(two.faretkAmount));
  three.replyFaretkAmount=fenExYuangettoFixed3(Number(one.replyFaretkAmount)-Number(two.replyFaretkAmount));
  three.replyFaretkAmountCY='';
  three.sum=fenExYuangettoFixed3(Number(one.sum)-Number(two.sum));

  res.push(one);
  res.push(two);
  res.push(three);
  return res;
}

export const cols2={
    emptyBtn:false,
    editBtn:false,
    delBtn:false,
    addBtn:false,
    border: true,
    index:false,
    menu:false,
    refreshBtn:false,
    columnBtn:false,
    indexLabel:'序号',
    page:false,
    align:'center',
    menuWidth:150,
    menuAlign:'center',
    selection: false,
    reserveSelection:false,
    column:[{
      label: '系统层级',
      prop: "type",
    },
      {
        width:120,
        label: '协查售票金额',
        prop: "sellAmount",
      },
      {
        width:120,
        label: '回馈售票金额',
        prop: "replySellAmount",
      },
      {
        width:140,
        label: '回馈后售票差异',
        prop: "replySellAmountCY",
      },
      {
        width:120,
        label: '协查充值金额',
        prop: "investAmount",
      },
      {
        width:120,
        label: '回馈充值金额',
        prop: "replyInvestAmount",
      },
      {
        width:140,
        label: '回馈后充值差异',
        prop: "replyInvestAmountCY",
      },
      {
        width:120,
        label: '协查补票金额',
        prop: "faretkAmount",
      },
      {
        width:120,
        label: '回馈补票金额',
        prop: "replyFaretkAmount",
      },
      {
        width:140,
        label: '回馈后补票差异',
        prop: "replyFaretkAmountCY",
      },
      {
        width:140,
        label: '回馈后票款合计',
        prop: "sum",
      }]
};

export function getCengJiXCInfo(query){

  return null;
}

/**
 * 数字转换
 * @param v
 * @returns {*}
 */
function ifNumberValueEmpty(v){
  v=v?v:0;
  return Number(v);
}


/**
 * 售票员层级差异待协查
 * @param query
 */
export async function replaceShoupiaoyuanCJCYDXC(query) {
  return request({
    url: '/check/check/replaceShoupiaoyuanCJCYDXC',
    method: 'post',
    params: query
  });
}


/**
 * 售票员层级差异待协查-下发
 * @param query
 */
export async function sendStatusSwAuConductorHierarchyAmountDifference(query) {
  return request({
    url: '/check/check/sendStatusSwAuConductorHierarchyAmountDifference',
    method: 'post',
    params: query
  });
}

/**
 * 售票员层级差异待协查-下发变为已协查
 * @param query
 */
export async function addAssistSwAuConductorHierarchyAmountDifference(query) {
  return request({
    url: '/check/check/addAssistSwAuConductorHierarchyAmountDifference',
    method: 'post',
    params: query
  });
}
